package com.example.administrator.funchat.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

import com.example.administrator.funchat.adapter.InformationAdapter;
import com.example.administrator.funchat.R;
import com.example.administrator.funchat.activity.ChatActivity;

/**
 * 消息界面fragment视图加载并适配
 * Created by Administrator on 2016/6/23.
 */
public class Information_fragment extends android.support.v4.app.Fragment {


    private ListView listview;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.information_tab, container, false);

        listview = (ListView) view.findViewById(R.id.info_listview);
        InformationAdapter adapter = new InformationAdapter(getActivity(), R.layout.info_item);
        listview.setAdapter(adapter);
        adapter.load();
        //设置消息界面item点击事件
        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent = new Intent(getContext(), ChatActivity.class);
                startActivity(intent);
            }
        });
        return view;
    }


}
